package common.data.report
{
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.RemoteObject;

	/**
	 * 定位服务类
	 */
	public class StaffVisitReportPlanService extends RemoteObject
	{
		public var queryStaffsVisitReportCallBack:Function;
		public var queryStaffVisitReportCallBack:Function;
		public var queryMapRegionResultCallBack:Function;
		
		
		public function StaffVisitReportPlanService() {
			super("staffVisitPlanReportService");
			this.showBusyCursor = true;
			this.getOperation("queryStaffsVisitReport").addEventListener(ResultEvent.RESULT,queryStaffsVisitReportResult,false,0,true);
			this.getOperation("queryStaffVisitReport").addEventListener(ResultEvent.RESULT,queryStaffVisitReportResult,false,0,true);
			this.getOperation("queryMapRegion").addEventListener(ResultEvent.RESULT,queryMapRegionResult,false,0,true);
		}
		
		public function queryStaffsVisitReport(staffIds:Array,startDate:String,endDate:String,visitLong:Number):void{
			this.getOperation("queryStaffsVisitReport").send(staffIds,startDate,endDate,visitLong);
		}
		public function queryStaffVisitReport(staffId:String,startDate:String,endDate:String,visitLong:Number):void{
			this.getOperation("queryStaffVisitReport").send(staffId,startDate,endDate,visitLong);
		}
		public function queryMapRegion(regionIds:Array):void{
			this.getOperation("queryMapRegion").send(regionIds);
		}
		
		//回调根据员工ID集合获取实时定位信息
		private function queryStaffsVisitReportResult(e:ResultEvent):void{
			try{
				if(queryStaffsVisitReportCallBack != null){
					queryStaffsVisitReportCallBack.apply(this,[e]);
				}
			}catch(error:Error){
				trace(error.getStackTrace());
			}
		}
		
		private function queryStaffVisitReportResult(e:ResultEvent):void{
			try{
				if(queryStaffVisitReportCallBack != null){
					queryStaffVisitReportCallBack.apply(this,[e]);
				}
			}catch(error:Error){
				trace(error.getStackTrace());
			}
		}
		private function queryMapRegionResult(e:ResultEvent):void{
			try{
				if(queryMapRegionResultCallBack != null){
					queryMapRegionResultCallBack.apply(this,[e]);
				}
			}catch(error:Error){
				trace(error.getStackTrace());
			}
		}
		
		
	}
}	